Multiply all the numbers in a listΒΆ
Write a python function to multiply all the numbers in a list.
Sample List :
(8, 2, 3, -1, 7)
Expected output:
-336
def multiply(numbers):
total = 1
for x in numbers:
total *= x
return total
# test
print(multiply((8, 2, 3, -1, 7)))
Output:
-336